package mc.support.web.action.invoke;

import mc.support.web.WebConstants;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created with IntelliJ IDEA. <br/>
 * Author: Francis Yun    <br/>
 * Date: 2014-04-21  <br/>
 */
public abstract class InvokerSupport implements WebConstants {

    protected HttpServletRequest getHttpReq(Map<String, Object> params) {
        Object raw = params.get( HTTP_REQUEST );
        HttpServletRequest req = null;
        if ( raw instanceof HttpServletRequest ) {
            req = (HttpServletRequest) raw;
        }
        return req;
    }

    protected HttpServletResponse getHttpResp(Map<String, Object> params) {
        Object raw = params.get( HTTP_RESPONSE );
        HttpServletResponse resp = null;
        if ( raw instanceof HttpServletResponse ) {
            resp = (HttpServletResponse) raw;
        }
        return resp;
    }

}
